# Maintainer: wahibre <wahibre@gmx.com>

_realname=mtn
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=3.4.0
pkgrel=1
pkgdesc="Command line program to save thumbnails (screenshots) of movie or video files into jpeg/png files (mingw-w64)"
arch=('any')
url="https://gitlab.com/movie_thumbnailer/mtn"
license=('GPL2')
source=("${url}/-/archive/v${pkgver}/${_realname}-v${pkgver}.tar.gz"
		"001-mtn-3.4.0-makefile.patch")
sha256sums=('e9509953f0a0c1eaba7e2fe96283970a209deb54143ff8a16103e13d3f74e5a3'
			'c551cf05c6b50fb5dd7e30deae3456bd0d497f8983cb639e25d2d2d70a7c5916')
makedepends=("${MINGW_PACKAGE_PREFIX}-make"
             "${MINGW_PACKAGE_PREFIX}-gcc"
             "patch")
depends=("${MINGW_PACKAGE_PREFIX}-ffmpeg"
         "${MINGW_PACKAGE_PREFIX}-libgd")

prepare() {
  cd "${srcdir}/${_realname}-v${pkgver}"
  patch -p1 -i ${srcdir}/001-mtn-3.4.0-makefile.patch
}

build() {
  cd "${srcdir}/${_realname}-v${pkgver}/src"
  mingw32-make
}

package() {
  cd "${srcdir}/${_realname}-v${pkgver}/src"
  mkdir -p ${pkgdir}/${MINGW_PREFIX}/bin/
  install -m 755 ../bin/mtn ${pkgdir}/${MINGW_PREFIX}/bin/
  mkdir -p ${pkgdir}/${MINGW_PREFIX}/share/man/man1
  cp -p ../man/mtn.1 ${pkgdir}/${MINGW_PREFIX}/share/man/man1/
}
